import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getFilmList } from '@/api'

export const useGoodsStore = defineStore('goods', () => {
  //获取数据
  const goods = ref<IFilmList | null>(null)

  //每一条数据
  const goodslist = computed(() => {
    return goods.value?.content
  })

  //获取数据
  async function getGoodsList() {
    //发送请求
    const list = await getFilmList()
   
    goods.value = list.feeds
  }

  return { getGoodsList, goods, goodslist }
})
